package com.sh.healthtv.database;

import com.sh.healthtv.database.model.HistoryProgram;

import org.litepal.crud.DataSupport;

import java.util.List;

/**
 * Created by zhouyucheng on 2017/8/10.
 */

public class LitepalTVHtoryUitils {
    public static boolean insertTVHtory(HistoryProgram program) {
        return program.save();
    }

    public static int deleteTVHtory(String useId) {
        return DataSupport.deleteAll(HistoryProgram.class, "useId = ? ", useId);

    }

    public static int updataTVHtory(HistoryProgram program, String useId) {
        return program.updateAll(" useId=? ", useId);
    }

    public static List<HistoryProgram> queryTVHtory(String useId) {
        return DataSupport.where("useId = ?", useId).find(HistoryProgram.class);
    }

    public static List<HistoryProgram> queryAllTVHtory() {
        return DataSupport.order("id desc").find(HistoryProgram.class);
    }
}
